<?php

namespace App\Models;

/**
 * 项目配置
 */
class MConfigs extends BaseModel
{
    public $table = "configs";    //指定表名

    /**
     * 保存配置
     */
    public function saveConfig($request)
    {
        $kv = [
            'webName' => $request->name,
            'logoPath' => strstr($request->path, 'files/'),
            'caseNumber' => $request->caseNumber,
            'linkman' => $request->linkman,
            'tel' => $request->tel,
            'address' => $request->address,
            'openDown' => $request->openDown,
            'downDesc' => $request->downDesc,
        ];

        $this->title = $request->title;
        $this->kv = serialize($kv);
        $this->time = time();

        return $this->save();
    }
}